<template>
	<page-meta :page-font-size="fontValue + 'rpx'" :root-font-size="fontValue + 'rpx'"></page-meta>
	<view class="content">
		<view><view class="fontchange">文字大小</view></view>
		<view style="width:100%;padding: 0 10px;">
			<slider :min="8" :max="16" :value="fontValue" @change="sliderChange" :step="2" />
			<view class="change-fontsize-box">
				<text style="font-size: 12px;">最小</text>
				<text style="font-size: 14px;">标准</text>
				<text style="font-size: 16px;">最大</text>
				<text style="font-size: 18px;">最大</text>
				<text style="font-size: 20px;">最大</text>
			</view>
		</view>
		<view style="padding: 20px 10px;width: 100%;"><button class="cu-btn block bg-blue lg" @click="submit">确定</button></view>
	</view>
</template>
<script>
export default {
	data() {
		return {
			fontValue: 10
		};
	},
	onShow() {
		this.fontValue = this.$store.getters.fontSize;
	},
	methods: {
		sliderChange(e) {
			this.fontValue = e.detail.value;
		},
		submit() {
			this.$store.commit('SET_FONT_SIZE', this.fontValue);
			uni.showToast({
				title: '设置成功',
				icon: 'none',
				duration: 1500
			});
		}
	}
};
</script>
<style>
.fontchange {
	font-size: 2.8rem;
	margin: 20px 0;
}
.content {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 5px;
	box-sizing: border-box;
}
.change-fontsize-box {
	margin: 10px 18px;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
}
</style>
